package geektime.spring.springbucks.mapper;

import geektime.spring.springbucks.model.Order;
import geektime.spring.springbucks.model.OrderExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.session.RowBounds;

public interface OrderMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    long countByExample(OrderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    int deleteByExample(OrderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    @Delete({
        "delete from T_ORDER",
        "where ID = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    @Insert({
        "insert into T_ORDER (CREATE_TIME, UPDATE_TIME, ",
        "CUSTOMER, STATE)",
        "values (#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{customer,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER})"
    })
    @SelectKey(statement="CALL IDENTITY()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Order record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    int insertSelective(Order record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    List<Order> selectByExampleWithRowbounds(OrderExample example, RowBounds rowBounds);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    List<Order> selectByExample(OrderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    @Select({
        "select",
        "ID, CREATE_TIME, UPDATE_TIME, CUSTOMER, STATE",
        "from T_ORDER",
        "where ID = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("geektime.spring.springbucks.mapper.OrderMapper.BaseResultMap")
    Order selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    int updateByExampleSelective(@Param("record") Order record, @Param("example") OrderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    int updateByExample(@Param("record") Order record, @Param("example") OrderExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    int updateByPrimaryKeySelective(Order record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_ORDER
     *
     * @mbg.generated Fri Feb 24 16:24:39 CST 2023
     */
    @Update({
        "update T_ORDER",
        "set CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},",
          "UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},",
          "CUSTOMER = #{customer,jdbcType=VARCHAR},",
          "STATE = #{state,jdbcType=INTEGER}",
        "where ID = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Order record);
}